const App = {
  /**
   * 判断当前App环境
   * 这里你可以根据自身的情况去改写
   * navigator.platform 可以返回你的系统的当前环境
   */
  appSource() {
    const platform = navigator.platform;
    if (platform == "MacIntel" || platform == "Win32") {
      return "Mac";
    } else if (platform == "iPhone") {
      return "ios";
    } else {
      return "android";
    }
  },

  //判断当前App环境
  appSource() {
    const u = navigator.userAgent;
    const isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
    if (isiOS) {
      return "ios";
    } else {
      return "android";
    }
  },

  //判断是否在微信环境里
  isWeiXin() {
    var ua = window.navigator.userAgent.toLowerCase();
    if (ua.match(/MicroMessenger/i) == "micromessenger") {
      return true;
    } else {
      return false;
    }
  },


  // 系统区分
  getOS() {
    var u = navigator.userAgent;
    if (!!u.match(/compatible/i) || u.match(/Windows/i)) {
      return 'windows';
    } else if (!!u.match(/Macintosh/i) || u.match(/MacIntel/i)) {
      return 'macOS';
    } else if (!!u.match(/iphone/i) || u.match(/Ipad/i)) {
      return 'ios';
    } else if (!!u.match(/android/i)) {
      return 'android';
    } else {
      return 'other';
    }
  }
}